# Programs, flags, etc.
ASM		= nasm
DASM		= ndisasm
AS		= as
CC		= gcc -march=i486
LD		= ld
AR		= ar
CPP		= gcc -E -nostdinc -I../../include
ASMFLAGS	= -f elf
CFLAGS		= -Wall -O -nostdinc -I../../include
LDFLAGS		= -r
ARFLAGS		= rcs

.c.o:
	$(CC) $(CFLAGS)	-c -o $*.o $<
.s.o:
	$(AS) -o $*.o $<
.S.o:
	$(ASM) $(ASMFLAGS) -o $*.o $<
.c.s:
	$(CC) $(CFLAGS) -S -o $*.s $<

# This Program
TARGET		= math.a
OBJS		= math_emulate.o

# All Phony Targets
.PHONY : all clean dep

# Default starting position
all : $(TARGET)

$(TARGET) : $(OBJS) 
	$(AR) $(ARFLAGS) $(TARGET) $(OBJS)

clean : 
	rm -f core $(TARGET)
cleanall :
	rm -f core *.o *.a tmp_make
#	for i in *.c; do rm -f 'basename $$i .c'.s;done
dep:
	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
	(for i in *.c;do $(CPP) -M $$i;done) >> tmp_make
	cp tmp_make Makefile
	rm tmp_make

### Dependencies:
math_emulate.o: math_emulate.c ../../include/signal.h \
  ../../include/sys/types.h ../../include/linux/sched.h \
  ../../include/linux/fs.h ../../include/linux/head.h \
  ../../include/linux/mm.h ../../include/linux/kernel.h \
  ../../include/stdarg.h ../../include/asm/segment.h
